/**
    Copyright (c) 2009 yakiimo02
    Distributed under the New BSD License.
    See included license.txt or http://www.yakiimo3d.com/NewBSDLicense.txt
**/

#pragma once

#include "BitonicSortCPU.h"

/**
    @brief  CPU implementation of Bitonic Sort that uses recursion.
            Based on code from http://www.tools-of-computing.com/tc/CS/Sorts/bitonic_sort.htm
            which I learned about from http://developer.download.nvidia.com/compute/cuda/sdk/website/samples.html
            the Nvidia Cuda SDK Bitonic Sort sample.
    @author yakiimo02
    @date    09/11/28
*/
class BitonicSortRecursiveCPU : public BitonicSortCPU
{
public:
    virtual void SortUp();
    virtual void SortDown();

protected:
    void Sort( int nCount );
    void SortUp( int nBegin, int nCount );
    void SortDown( int nBegin, int nCount );

    void MergeUp( int nBegin, int nCount );
    void MergeDown( int nBegin, int nCount );
};

